package pluginannotation.editors;

import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.presentation.IPresentationReconciler;
import org.eclipse.jface.text.presentation.PresentationReconciler;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;

public class FeatureConfiguration extends SourceViewerConfiguration {
	private ColorManager colorManager;

	public FeatureConfiguration(ColorManager colorManager) {
		this.colorManager = colorManager;
	}

	public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
		PresentationReconciler reconciler = new PresentationReconciler();

		NonRuleBasedDamagerRepairer ndr =	
			new NonRuleBasedDamagerRepairer(
				new TextAttribute(
					colorManager.getColor(IFeatureColorConstants.FEATURE_CONTENT))); 
		reconciler.setDamager(ndr, Feature.FEATURE_CONTENT); 
		reconciler.setRepairer(ndr, Feature.FEATURE_CONTENT);

		return reconciler;
	}

}